﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Sg.Silverlight.Utilities.SpellChecker.Test
{
  public partial class MainPage : UserControl
  {
    GoogleSpellCheckProvider _provider;
    public MainPage()
    {
      InitializeComponent();
      _provider = new GoogleSpellCheckProvider();
      _provider.SpellCheckCompleted += _provider_SpellCheckCompleted;
    }

    void _provider_SpellCheckCompleted(Api.SpellCheckResponse obj)
    {
      suggestions.ItemsSource = obj.Results.SelectMany(o => o.Suggestions);
    }

    private void Button_Click_1(object sender, RoutedEventArgs e)
    {
      _provider.DoSpellCheck(new Api.SpellCheckRequest()
      {
        TextClipped = false,
        IgnoreDuplicates = true,
        Terms = Editor.Text.Split(' ')
      });
    }
  }
}
